July 15, 2020
Lets see some more commands here.
import os
import pandas as pd
import numpy as np
import matplotlib as mlt
Obj1csv = pd.readcsv(“sample_file.csv”, sep = ’,‘)
I have saved a samplefile.csv with few rows under bin directory, which was assigned to Obj1csv object and then it was read using Obj1_csv. Check out below.
Before proceeding this, install xlrd package under bin, using below command. Else you will get an import error.
pip install xlrd //Installing xlrd
Now below is the command to read excel file.
Obj1excel = pd.readexcel(“Filename.xls”)
Note: - Files that you would like to read to be placed under the bin directory where your python is installed.
Obj1excel.head(3) - will give first three rows
Obj1excel.tail(3) - will give last three rows
Obj1_excel (Its the object name in which excel file is loaded)
Obj1excel.columns- Gives the column names
Obj1excel.shape- Gives number of rows and columns
type(Obj1_excel)- Gives type/structure
With this we will end this page, More and more commands are in line.. We will catch up soon!!!